package app.chatroom.web.sys_ollama_ai.Service;

import lombok.RequiredArgsConstructor;
import org.springframework.ai.chat.model.ChatResponse;
import org.springframework.ai.ollama.OllamaChatModel;

import org.springframework.stereotype.Service;
import reactor.core.publisher.Flux;

@Service
@RequiredArgsConstructor
public class OllAmaStreamingService {

    private final OllamaChatModel ollamaChatModel;
    // 流式生成方法
    public Flux<String> streamGeneration(String prompt) {
        return ollamaChatModel.stream(prompt);
    }

    public String demo() {
        return ollamaChatModel.call("帮我写一个java 获取8080端口json数据的程序");
    }

    public String hello() {
        return ollamaChatModel.call("你好");
    }

    public String callTxt(String txt) {
        return ollamaChatModel.call(txt);
    }

}
